#ifndef GRIDWIDGET_H
#define GRIDWIDGET_H

#include <QWidget>
#include <list>
#include <QTimer>
#include "Common.h"
class World;

class GridWidget : public QWidget
{
Q_OBJECT
public:
    explicit GridWidget(QWidget *parent = 0);
    ~GridWidget();
    void toggleTimer(bool isRun);
signals:

public slots:

protected:
    virtual void paintEvent(QPaintEvent *);
    void mousePressEvent(QMouseEvent *event);

    int getCellSize() const {
        return height() / m_row;
    }

private slots:
    void stepWorld();

private:
    QRect cellRect(int row, int column) const;

    CellContainer m_cells;
    int m_row;
    int m_col;
    World *m_world;
    QTimer *m_timer;
};

#endif // GRIDWIDGET_H
